package com.mfangsoft.zhuangjialong.integration.productcategory.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mfangsoft.zhuangjialong.integration.productcategory.mapper.ProductCategoryEntityMapper;
import com.mfangsoft.zhuangjialong.integration.productcategory.model.ProductCategoryEntity;
import com.mfangsoft.zhuangjialong.integration.productcategory.service.ProductCategoryService;
@Service
public class ProductCategoryServiceImpl implements ProductCategoryService{

	@Autowired
	private ProductCategoryEntityMapper productCategoryEntityMapper;
	
	@Override
	public Boolean addProductCategory(ProductCategoryEntity categoryEntity) {
		// TODO Auto-generated method stub
		productCategoryEntityMapper.insertSelective(categoryEntity);
		return true;
	}

	@Override
	public Boolean modifyProductCategory(ProductCategoryEntity categoryEntity) {
		// TODO Auto-generated method stub
		productCategoryEntityMapper.updateByPrimaryKeySelective(categoryEntity);
		return true;
	}

	@Override
	public Boolean removeProductCategory(Long id) {
		// TODO Auto-generated method stub
		productCategoryEntityMapper.deleteByPrimaryKey(id);
		return true;
	}

	@Override
	public ProductCategoryEntity getProductCategory(Long id) {
		// TODO Auto-generated method stub
		return productCategoryEntityMapper.selectByPrimaryKey(id);
	}

	@Override
	public List<ProductCategoryEntity> queryProductCategory(String type,Long p_id) {
		
		
		Map<String,Object> e= new HashMap<>();
		
		e.put("type", type);
		
		e.put("p_id", p_id);
		// TODO Auto-generated method stub
		return productCategoryEntityMapper.queryProductCategory(e);
	}

	@Override
	public List<ProductCategoryEntity> queryProductCategoryAll() {
		// TODO Auto-generated method stub
		return productCategoryEntityMapper.queryProductCategoryAll();
	}

}
